# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-09-05
# @File : Demo_mitmproxy.py

from mitmproxy import http
from mitmproxy.net.server_spec import ServerSpec


def request(flow: http.HTTPFlow):
    ip = "101.35.210.130"
    port = 3128
    address = (ip, port)
    flow.server_conn.via = ServerSpec("http", address)


def response(flow: http.HTTPFlow):
    # B站的注册接口
    # if flow.request.path == "/x/passport-login/oauth2/access_token":

    res = flow.response.content
    print("响应返回数据----->", res.decode("utf-8"))

# mitmdump  -s  Demo_mitmproxy.py -q
# mitmdump -p 8080 -s Demo_mitmproxy.py --set block_global=false  --set upstream_cert=false --set connection_strategy=lazy -q
